package com.x.chalk.controller;

import com.x.chalk.config.SystemConfig;
import com.x.chalk.service.intf.UsefulNewsLikesService;
import com.x.chalk.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/usefulnewslikes/")
@Api(tags = "干货文章点赞")
@CrossOrigin
public class UsefulNewsLikesController {
    @Autowired
    private UsefulNewsLikesService service;

    /**
     * 点赞操作
     */
    @GetMapping("likes.do")
    public R like(@ApiParam(value = "文章id")Integer id,HttpServletRequest request) {
        return service.like(id, request.getHeader(SystemConfig.HEADER_TOKEN));
    }
}
